package com.example.split.conf;

import com.example.split.service.ISplitService;
import com.example.split.service.impl.ISplitServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(SplitProperties.class)
@ConditionalOnClass(value = {ISplitService.class, ISplitServiceImpl.class})
@ConditionalOnProperty(prefix = "split", value = "enable", havingValue = "true")
public class SplitAutoConfigure {

    @Bean
    public ISplitService startService() {
        return new ISplitServiceImpl();
    }
}
